<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:67:"F:\liudian\fly_forum\public/../application/index\view\User\set.html";i:1520393609;s:53:"F:\liudian\fly_forum\application\index\view\base.html";i:1520410612;}*/ ?>


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $title; ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="fly,layui,前端社区">
    <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" href="/fly_forum/public/static/layui/css/layui.css">
    <link rel="stylesheet" href="/fly_forum/public/static/home/css/global.css">
</head>
<body>

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="<?php echo url('Index/index'); ?>">
            <img src="/fly_forum/public/static/home/images/logo.png" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="<?php echo url('Index/index'); ?>"><i class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item">
                <a href="#" onclick="WeAdminShow('在线直播','https://staticlive.douyucdn.cn/common/share/play.swf?room_id=85894')"><i class="iconfont icon-iconmingxinganli"></i>在线直播</a>
            </li>
            <li class="layui-nav-item">
                <a href="#" onclick="WeAdminShow('在线电影','http://www.cmmov.net/')"><i class="iconfont icon-ui"></i>在线影视</a>
            </li>
        </ul>

        <ul class="layui-nav fly-nav-user">

            
            <?php if(empty(\think\Session::get('home'))): ?>
                <!-- 未登入的状态 -->
                <li class="layui-nav-item">
                    <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/login'); ?>"></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/login'); ?>">登入</a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/reg'); ?>">注册</a>
                </li>
            <?php else: ?>
                <!-- 登入后的状态 -->
                <li class="layui-nav-item">
                    <?php if(empty(\think\Session::get('home.image'))): ?>
                        <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/set'); ?>"></a>
                    <?php else: ?>
                        <a  href="<?php echo url('User/set'); ?>"><img style="height: 40px;width: 40px;border-radius: 20px" src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',session('home.image'),0); ?>"></a>
                    <?php endif; ?>

                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/set'); ?>"><?php echo \think\Session::get('home.name'); ?></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/loginOut'); ?>">退出</a>
                </li>
            <?php endif; if(empty(\think\Session::get('home'))): ?>
            <li class="layui-nav-item layui-hide-xs">
                <a href="<?php echo url('User/qqlogin'); ?>" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" title="QQ登入" class="iconfont icon-qq"></a>
            </li>
            <!-- <li class="layui-nav-item layui-hide-xs">
                <a href="/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" title="微博登入" class="iconfont icon-weibo"></a> -->
            </li>
            <?php else: endif; ?>

            
        </ul>
    </div>
</div>



<script src="/fly_forum/public/static/home/js/jquery-1.7.2.js"></script>
<script src="/fly_forum/public/static/layui/layui.js"></script>

<div class="layui-container fly-marginTop fly-user-main">
    <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
        <li class="layui-nav-item">
            <a href="<?php echo url('User/home'); ?>">
                <i class="layui-icon">&#xe609;</i>
                我的主页
            </a>
        </li>
        <li class="layui-nav-item">
            <a href="<?php echo url('User/userCenter'); ?>">
                <i class="layui-icon">&#xe612;</i>
                用户中心
            </a>
        </li>
        <li class="layui-nav-item layui-this">
            <a href="<?php echo url('User/set'); ?>">
                <i class="layui-icon">&#xe620;</i>
                基本设置
            </a>
        </li>
        <li class="layui-nav-item">
            <a href="<?php echo url('User/message'); ?>">
                <i class="layui-icon">&#xe611;</i>
                我的消息
            </a>
        </li>
    </ul>

    <div class="site-tree-mobile layui-hide">
        <i class="layui-icon">&#xe602;</i>
    </div>
    <div class="site-mobile-shade"></div>

    <div class="site-tree-mobile layui-hide">
        <i class="layui-icon">&#xe602;</i>
    </div>
    <div class="site-mobile-shade"></div>


    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief" lay-filter="user">
            <ul class="layui-tab-title" id="LAY_mine">
                <li class="layui-this" lay-id="info">我的资料</li>
                <li lay-id="avatar">头像</li>
                <li lay-id="pass">密码</li>
                <li lay-id="bind">帐号绑定</li>
            </ul>
            <div class="layui-tab-content" style="padding: 20px 0;">
                <div class="layui-form layui-form-pane layui-tab-item layui-show">
                    <form method="post" action="<?php echo url('User/saveSetUser'); ?>">
                        <div class="layui-form-item">
                            <label for="L_email" class="layui-form-label">邮箱</label>
                            <input type="hidden" id="user_city" value="<?php echo $userinfo['city']; ?>">
                            <div class="layui-input-inline">
                                <input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" value="<?php echo $userinfo['email']; ?>" class="layui-input" disabled>
                            </div>

                        </div>
                        <div class="layui-form-item">
                            <label for="L_username" class="layui-form-label">昵称</label>
                            <div class="layui-input-inline">
                                <input type="text" id="L_username" name="username" required lay-verify="required" autocomplete="off" value="<?php echo $userinfo['name']; ?>" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="L_sex" class="layui-form-label">性别</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="sex" value="0" <?php echo $userinfo['sex']==0?'checked' : ''; ?> title="男">
                                <input type="radio" name="sex" value="1" <?php echo $userinfo['sex']==1?'checked' : ''; ?> title="女">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label for="L_city" class="layui-form-label">城市</label>
                            <div class="layui-input-inline">
                                <select name="provice" lay-verify="required" id="provice" lay-filter="provice">
                                    <option value="">请选择省份</option>
                                </select>
                            </div>
                            <!-- <div class="layui-input-inline">
                              <select name="city" lay-verify="required" id="city" lay-filter="city">
                                <option value="">请选择市</option>
                              </select>
                            </div> -->
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label for="L_sign" class="layui-form-label">签名</label>
                            <div class="layui-input-block">
                                <textarea placeholder="随便写些什么刷下存在感" id="L_sign"  name="sign" autocomplete="off" class="layui-textarea" style="height: 80px;"><?php echo $userinfo['sign']; ?></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" key="set-mine"  lay-submit>确认修改</button>
                        </div>
                    </form>
                </div>


                <div class="layui-form layui-form-pane layui-tab-item">
                    <div class="layui-form-item">
                        <div class="avatar-add">
                            <p>建议尺寸168*168，支持jpg、png、gif，最大不能超过50KB</p>
                            <button type="button" class="layui-btn upload-img" id="test1">
                                <i class="layui-icon">&#xe67c;</i>上传头像
                            </button>
                            <div class="layui-upload-list">
                                <?php if(empty(\think\Session::get('home.image'))): ?>
                                <img class="layui-upload-img demo1" src="/fly_forum/public/static/head.jpg">
                                <?php else: ?>
                                <img class="layui-upload-img demo1" src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',session('home.image'),0); ?>">
                                <?php endif; ?>

                                <p id="demoText"></p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form layui-form-pane layui-tab-item">
                    <form action="<?php echo url('User/repass'); ?>" method="post" id="repass">
                        <div class="layui-form-item">
                            <label for="L_nowpass" class="layui-form-label">当前密码</label>
                            <div class="layui-input-inline">
                                <input type="password" id="L_nowpass" name="nowpass" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux"></div>
                        </div>
                        <div class="layui-form-item">
                            <label for="L_pass" class="layui-form-label">新密码</label>
                            <div class="layui-input-inline">
                                <input type="password" id="L_pass" name="pass" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">6到16个字符</div>
                        </div>
                        <div class="layui-form-item">
                            <label for="L_repass" class="layui-form-label">确认密码</label>
                            <div class="layui-input-inline">
                                <input type="password" id="L_repass" name="repass" required lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux"></div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" key="set-mine"  lay-submit>确认修改</button>
                        </div>
                    </form>
                </div>

                <div class="layui-form layui-form-pane layui-tab-item">
                    <ul class="app-bind">
                        <li class="fly-msg app-havebind">
                            <i class="iconfont icon-qq"></i>
                            <!-- <span>已成功绑定，您可以使用QQ帐号直接登录Fly社区，当然，您也可以</span> -->
                            <?php if($qq_field == 0): ?>
                            <a href="<?php echo url('user/qqlogin'); ?>"   class="acc-bind" type="qq_id" >立即绑定</a>
                            <span>，即可使用QQ帐号登录Fly论坛</span>
                            <?php else: ?>
                            <a href="<?php echo url('user/qqout'); ?>" class="acc-unbind" type="qq_id">解除绑定</a><span>，解除绑定前请设置好登录邮箱</span>
                            <?php endif; ?>

                        </li>
                        <!-- <li class="fly-msg">
                          <i class="iconfont icon-weibo"></i>
                          <span>已成功绑定，您可以使用微博直接登录Fly社区，当然，您也可以</span>
                          <a href="javascript:;" class="acc-unbind" type="weibo_id">解除绑定</a>

                          <a href="" class="acc-weibo" type="weibo_id"  onclick="layer.msg('正在绑定微博', {icon:16, shade: 0.1, time:0})" >立即绑定</a>
                          <span>，即可使用微博帐号登录Fly社区</span>
                        </li> -->
                    </ul>
                </div>
            </div>

        </div>
    </div>
</div>
</div>

<div class="fly-footer">
    <p><a href="http://fly.layui.com/" target="_blank">Fly社区</a> 2017 &copy; <a href="http://www.layui.com/" target="_blank">layui.com 出品</a></p>
    <p>
        <a href="http://fly.layui.com/jie/3147/" target="_blank">付费计划</a>
        <a href="http://www.layui.com/template/fly/" target="_blank">获取Fly社区模版</a>
        <a href="http://fly.layui.com/jie/2461/" target="_blank">微信公众号</a>
    </p>
</div>

<script src="/fly_forum/public/static/home/js/cityInfo.js"></script>
<script >

    $(function(){
        var city = $("#user_city").val();
        $.each(cityData, function() {
            //        document.write(this.code+"|"+this.name)
            if(this.type== 1){
                if(city == this.name){
                    $("<option selected></option>").val(this.name).text(this.name).appendTo("#provice");
                }else{
                    $("<option></option>").val(this.name).text(this.name).appendTo("#provice");
                }

            }
        })
    })
    layui.use('upload', function(){
        var $ = layui.jquery
                ,upload = layui.upload;

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            ,accept : "images"
            ,url: "<?php echo url('User/uploadHeadImg'); ?>"
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('.demo1').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
                //上传成功
                document.location.href = "<?php echo url('User/set'); ?>"
            }
            ,error: function(){

            }
        });
    });
    // layui.use('form', function(){
    //       var form = layui.form;
    //       form.on('select(provice)', function(data){
    //         // console.log(data.value);

    //         //              得到省份的code
    //         var userval = data.value;
    //         //              清除城市数据
    //         // $("#city>option:gt(0)").remove();

    //         $.each(cityData, function() {
    //                 if(this.parentCode == userval) {
    //                     console.log(this.code);
    //                     console.log(this.name);
    //                     console.log($("#city"));
    //                     $("<option></option>").val(this.code).text(this.name).appendTo("#provice");
    //                     // var content = "<option value="+this.code+">"+this.name+"</option>";
    //                     // $("#city").append(content);
    //                     // $("<option></option>").val(this.code).text(this.name).appendTo("#city")

    //                 }

    //         });

    //     });
    // });
    var childWindow;
    function toQzoneLogin() {
        childWindow = window.open("http://localhost/fly_forum/public/index.php/index/user/qqlogin", "TencentLogin", "width=850,height=520,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
    }
    function closeChildWindow() {
        childWindow.close();
    }

    var check_pass = false;
    $("#L_pass").blur(function(){

        var pass = $("#L_pass").val();
        if(pass.length > 16 || pass.length < 6){
            $("#L_pass").parent().next().removeClass("layui-word-aux").css("color","red");
            check_pass = false;
        }else{
            $("#L_pass").parent().next().addClass("layui-word-aux");
            check_pass = true;
        }
    })

    $("#repass").submit(function(){

        if(check_pass){
            return true;
        }else{
            return false;
        }
    })

</script>


<script>
    layui.cache.page = '';
    layui.cache.user = {
        username: '游客'
        ,uid: -1
        ,avatar: '/fly_forum/public/static/home/images/avatar/00.jpg'
        ,experience: 83
        ,sex: '男'
    };
    layui.config({
        version: "3.0.0"
        ,base: '/fly_forum/public/static/home/mods/' //这里实际使用时，建议改成绝对路径
    }).extend({
        fly: 'index'
    }).use('fly');



    /*
     * @todo 弹出层，弹窗方法
     * layui.use 加载layui.define 定义的模块，当外部 js 或 onclick调用 use 内部函数时，需要在 use 中定义 window 函数供外部引用
     * http://blog.csdn.net/xcmonline/article/details/75647144 
     */
    /*
        参数解释：
        title   标题
        url     请求的url
        id      需要操作的数据id
        w       弹出层宽度（缺省调默认值）
        h       弹出层高度（缺省调默认值）
    */
    window.WeAdminShow = function(title, url, w, h) {
        if(title == null || title == '') {
            title = false;
        };
        if(url == null || url == '') {
            url = "404.html";
        };
        if(w == null || w == '') {
            w = ($(window).width() * 0.9);
        };
        if(h == null || h == '') {
            h = ($(window).height() - 50);
        };
        layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: true,
            shade: 0.4,
            title: title,
            content: url
        });
    }
</script>

<!-- <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script> -->

</body>
</html>